package com.ciei.dpagm.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ciei.dpagm.common.service.BaseService;
import com.ciei.dpagm.entity.ProjectMasterChipClockParameter;
import com.ciei.dpagm.mapper.ProjectMasterChipClockParameterMapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author pp
 * @date 2023/05/09
 */
@Service
public class ProjectMasterChipClockParameterService extends BaseService<ProjectMasterChipClockParameterMapper, ProjectMasterChipClockParameter> {

    /**
     * 获取列表
     * @param projectMasterChipConfigIdList
     * @return
     */
    public List<ProjectMasterChipClockParameter> getList(List<Integer> projectMasterChipConfigIdList){
        if(projectMasterChipConfigIdList.isEmpty()){
            return new ArrayList<>();
        }
        LambdaQueryWrapper<ProjectMasterChipClockParameter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.in(ProjectMasterChipClockParameter::getProjectMasterChipConfigId,projectMasterChipConfigIdList);
        return list(lambdaQueryWrapper);
    }

    /**
     * 根据配置id列表删除
     * @param projectMasterChipConfigIdList
     */
    public void removeByConfigIdList(List<Integer> projectMasterChipConfigIdList){
        if(projectMasterChipConfigIdList.isEmpty()){
            return;
        }
        LambdaQueryWrapper<ProjectMasterChipClockParameter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.in(ProjectMasterChipClockParameter::getProjectMasterChipConfigId,projectMasterChipConfigIdList);
        remove(lambdaQueryWrapper);
    }
}
